class PostSerializer(serializers.ModelSerializer):
replied = serializers.SerializerMethodField('has_replies')
def has_replies(post):
return post.replies.filter(owner=self.context["request"].user).exists()
class Meta:
fields = ('id', 'name', 'replied')